<?php
require_once(BASE_CARD_FILE);
require_once(GAME_CONFIG_FILE);
require_once(RANDOM_FILE);

class CardsDeck
{
	private $id = 1;
	private $card_array = array();
	
	public static function Instance() {
		static $inst = null;
		if ($inst === null) {
			$inst = new CardsDeck();
		}
		return $inst;
	}
	private function get_new_id() {
		return $this->id++;
	}
	public function get_max_id() {
		return $this->id;
	}
	public function card_id($id) {
		if($id >= $this->get_max_id() || $id < 0) {
			return -1;
		}
		return $this->card_array[$id-1]->ID();
	}
	public function card_hp($id) {
		if($id >= $this->get_max_id() || $id < 0) {
			return -1;
		}
		return $this->card_array[$id-1]->HP();
	}
	public function card_dmg($id) {
		if($id >= $this->get_max_id() || $id < 0) {
			return -1;
		}
		return $this->card_array[$id-1]->DMG();
	}
	//card init	
	private function __construct() {
		$this->card_array[] = new Base_card($this->get_new_id(), 50, 100);
		$this->card_array[] = new Base_card($this->get_new_id(), 100, 50);
		$this->card_array[] = new Base_card($this->get_new_id(), 75, 75);
	}	
        
	public function random_card_id() {
		return Random::get_random_num(1, $this->get_max_id()-1);
	}
}
?>